﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views.popups.treatment {
    import reprise.ui.*;
    import flash.events.*;
    import flash.display.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.interfaces.*;
    import net.wooga.pets.constants.*;
    import net.wooga.pets.utils.*;

    public class NewDiseasePopupMediator extends TreatmentPopupMediator {

        override public function onRegister():void{
            super.onRegister();
            var _local1:ITreatable = ITreatable(this.view.data);
            var _local2:String = _local1.diseaseType;
            var _local3:int = _local1.diseaseId;
            var _local4:Array = Arrays.getAllValuesOfAttribute(_local1.treatments, "roomType");
            var _local5:int = _local1.currentTreatment.duration;
            var _local6:String = _local1.durationType;
            var _local7:int = _local1.currentTreatment.xp;
            var _local8:int = _local1.currentTreatment.coins;
            var _local9:UIComponent = RepriseUtils.addComponent(this.view, "contentDisplay myriadProFont");
            addOkButton(okButtonLabel, _local9);
            addLabel("title", ("global_disease_no" + _local3), null, _local9);
            setPatient(_local9, (_local2 + "Walk"), 200);
            var _local10:UIComponent = RepriseUtils.addComponent(_local9, "newDiseaseInfoBox");
            var _local11:UIComponent = RepriseUtils.addComponent(_local10, null, null, "infoContainer");
            addLabel("infoTitle", "global_needrooms_copy", null, _local11);
            this.addTreatmentIcons(_local4, _local11);
            dispatch(new InfoEvent(EventConstants.DISPLAY_TREATMENT_COSTS, _local6, {time:_local5, container:_local11}));
            addLabel("infoTitle", "global_youget_copy", null, _local11, "youget");
            this.addReward("xpReward", "global_XP", _local8, _local11);
            this.addReward("coinReward", "global_coins", _local7, _local11);
            addPatientPicture("CuredAnimalsPolaroid", (_local2 + "Still"), 50, 50, _local10);
        }
        override protected function onOk(_arg1:MouseEvent):void{
            super.onOk(_arg1);
            sendPostOnWall(GameConstants.POST_NEW_DISEASE);
        }
        private function addReward(_arg1:String, _arg2:String, _arg3:int, _arg4:UIComponent):void{
            var _local5:Object = {amount:_arg3, numerator:_arg2, denominator:"global_room"};
            addLabel("unit myriadProFont", "global_unit_fraction", _local5, _arg4, _arg1);
        }
        private function addTreatmentIcons(_arg1:Array, _arg2:UIComponent):void{
            var _local4:String;
            var _local5:MovieClip;
            var _local3:UIComponent = RepriseUtils.addComponent(_arg2, "treatmentIcons");
            for each (_local4 in _arg1) {
                _local5 = AssetsLibrary.getMovieClip(("CustomizeIcon" + _local4));
                AssetsLibrary.getMovieClip(("CustomizeIcon" + _local4)).width = (_local5.height = 45);
                RepriseUtils.addClipComponent(_local3, "treatmentIcon", _local5);
            };
        }
        private function get view():NewDiseasePopupView{
            return ((viewComponent as NewDiseasePopupView));
        }

    }
}//package net.wooga.pets.views.popups.treatment 
